home *** CD-ROM | disk | FTP | other *** search
/ mail.altrad.com / 2015.02.mail.altrad.com.tar / mail.altrad.com / TEST / office german / PROPLUS.WW / PROPLSWW.CAB / TAG.XSL < prev    next >
Extensible Markup Language  |  2006-07-16  |  35KB  |  995 lines

  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2.  
  3.  
  4. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  5.     xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography">
  6.     <xsl:output method="xml" encoding="us-ascii"/>
  7.  
  8.  
  9.  
  10.     <xsl:variable name="const_SepNames">
  11.         <xsl:text>; </xsl:text>    
  12.     </xsl:variable>
  13.  
  14.     <xsl:variable name="const_SepLastFirst">
  15.         <xsl:text>, </xsl:text>    
  16.     </xsl:variable>
  17.  
  18.     <xsl:variable name="const_Space">
  19.         <xsl:text> </xsl:text>    
  20.     </xsl:variable>
  21.  
  22.     <xsl:variable name="const_BracketOpen">
  23.         <xsl:text>(</xsl:text>    
  24.     </xsl:variable>
  25.  
  26.     <xsl:variable name="const_BracketClose">
  27.         <xsl:text>)</xsl:text>    
  28.     </xsl:variable>
  29.  
  30.  
  31.  
  32.  
  33.     <xsl:template match="/">
  34.         <xsl:choose>
  35.             <xsl:when test="b:OfficeSortKey">
  36.                 <Key><xsl:text>Tag</xsl:text></Key>
  37.             </xsl:when>
  38.  
  39.             <xsl:when test="b:Sources">
  40.                 <xsl:variable name="ListPopulatedWithMain">
  41.                     <xsl:call-template name="populateMain">
  42.                         <xsl:with-param name="Type">b:Sources</xsl:with-param>
  43.                     </xsl:call-template>
  44.                 </xsl:variable>
  45.                 
  46.                 <xsl:variable name="sList">
  47.                     <xsl:call-template name="sortedList">
  48.                         <xsl:with-param name="sourceRoot">
  49.                             <xsl:copy-of select="$ListPopulatedWithMain"/>
  50.                         </xsl:with-param>
  51.                         
  52.                     </xsl:call-template>
  53.                 </xsl:variable>
  54.  
  55.                 
  56.                 
  57.                 <Sources xmlns="http://schemas.openxmlformats.org/officeDocument/2006/bibliography">
  58.                 <xsl:for-each select="msxsl:node-set($sList)/b:Sources/b:Source">
  59.                     <Source>
  60.                         <xsl:copy-of select="b:Tag"/>
  61.                         <Display>
  62.  
  63.                             <xsl:variable name="display">
  64.  
  65.                                 <xsl:variable name="allAuthors">
  66.                                     <xsl:if test="string-length(b:Author/b:Main/b:Corporate)=0">
  67.                                         <xsl:for-each select="b:Author/b:Main">
  68.                                           <xsl:call-template name="formatPersonsAuthor"/>
  69.                                         </xsl:for-each>
  70.                                     </xsl:if>
  71.                                     <xsl:if test="string-length(b:Author/b:Main/b:Corporate)>0">
  72.                                           <xsl:value-of select="b:Author/b:Main/b:Corporate"/>
  73.                                     </xsl:if>                                        
  74.                                 </xsl:variable>
  75.  
  76.                                 <xsl:value-of select="b:Tag"/>
  77.  
  78.                                 <xsl:if test="string-length($allAuthors) > 0">
  79.                                     <xsl:value-of select="$const_SepLastFirst"/>
  80.                                     <xsl:value-of select="$allAuthors"/>
  81.                                 </xsl:if>
  82.  
  83.                                 <xsl:if test="string-length(b:Title) > 0">
  84.                                     <xsl:value-of select="$const_SepNames"/>
  85.                                     <xsl:value-of select="b:Title"/>
  86.                                 </xsl:if>
  87.  
  88.                                 <xsl:if test="string-length(b:Year) > 0">
  89.                                     <xsl:value-of select="$const_Space"/>
  90.                                     <xsl:value-of select="$const_BracketOpen"/>
  91.                                     <xsl:value-of select="b:Year"/>
  92.                                     <xsl:value-of select="$const_BracketClose"/>
  93.                                 </xsl:if>
  94.                             </xsl:variable>
  95.                             
  96.                             <xsl:choose>
  97.                                 <xsl:when test="string-length(normalize-space($display))>0">
  98.                                     <xsl:value-of select="$display"/>
  99.                                 </xsl:when>
  100.                                 <xsl:otherwise>
  101.                                     <xsl:value-of select="b:Tag"/>
  102.                                 </xsl:otherwise>
  103.                             </xsl:choose>
  104.                         </Display>
  105.                         <SimpleSearch>
  106.                             <xsl:call-template name="simplesearchSource"/>
  107.                         </SimpleSearch>
  108.                     </Source>
  109.                 </xsl:for-each>
  110.                 </Sources>
  111.             </xsl:when>
  112.         </xsl:choose>
  113.     </xsl:template>
  114.  
  115.     
  116.     <xsl:template name="sortedList">
  117.         <xsl:param name="sourceRoot"/>
  118.         
  119.         <xsl:apply-templates select="msxsl:node-set($sourceRoot)/*">
  120.             <xsl:sort select="b:Tag"/>
  121.         </xsl:apply-templates>
  122.         
  123.     </xsl:template>
  124.  
  125.  
  126.     <xsl:template match="*">
  127.         <xsl:element name="{name()}" namespace="{namespace-uri()}">
  128.             <xsl:for-each select="@*">
  129.                 <xsl:attribute name="{name()}" namespace="{namespace-uri()}">
  130.                     <xsl:value-of select="." />
  131.                 </xsl:attribute>
  132.             </xsl:for-each>
  133.             <xsl:apply-templates>        
  134.                 <xsl:sort select="b:Tag" />
  135.             </xsl:apply-templates>
  136.         </xsl:element>
  137.     </xsl:template>
  138.  
  139.     <xsl:template match="text()">
  140.         <xsl:value-of select="." />
  141.     </xsl:template>
  142.     
  143.     <xsl:template name="populateMain">
  144.         <xsl:param name="Type"/>
  145.         
  146.         <xsl:element name="{$Type}">
  147.             
  148.             <xsl:for-each select="/*[$Type]/b:Source">
  149.                 
  150.                 <xsl:variable name="MostImportantAuthorLocalName">
  151.                     
  152.                     <xsl:call-template name="MainContributors"/>
  153.                 </xsl:variable>
  154.                 <xsl:element name="{'b:Source'}">
  155.           
  156.           <b:Title>
  157.             
  158.             <xsl:if test="string-length(b:Title)>0">
  159.               <xsl:value-of select="b:Title"/>
  160.             </xsl:if>
  161.             
  162.             <xsl:if test="string-length(b:Title)=0">
  163.               <xsl:choose>
  164.                 <xsl:when test="b:SourceType='Book' or
  165.                                 b:SourceType='JournalArticle' or
  166.                                 b:SourceType='ConferenceProceedings' or
  167.                                 b:SourceType='Report' or
  168.                                 b:SourceType='Performance' or
  169.                                 b:SourceType='Film' or
  170.                                 b:SourceType='Patent' or
  171.                                 b:SourceType='Case'">
  172.  
  173.                   <xsl:value-of select="b:ShortTitle"/>
  174.                 </xsl:when>
  175.  
  176.                 <xsl:when test="b:SourceType='BookSection'">
  177.                   <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  178.                   <xsl:variable name="bookTitle" select="b:BookTitle"/>
  179.  
  180.                   <xsl:choose>
  181.                     <xsl:when test="string-length($shortTitle)>0">
  182.                       <xsl:value-of select="$shortTitle"/>
  183.                     </xsl:when>
  184.                     <xsl:when test="string-length($bookTitle)>0">
  185.                       <xsl:value-of select="$bookTitle"/>
  186.                     </xsl:when>
  187.                   </xsl:choose>
  188.  
  189.                 </xsl:when>
  190.  
  191.                 <xsl:when test="b:SourceType='ArticleInAPeriodical'">
  192.                   <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  193.                   <xsl:variable name="periodicalTitle" select="b:PeriodicalTitle"/>
  194.  
  195.                   <xsl:choose>
  196.                     <xsl:when test="string-length($shortTitle)>0">
  197.                       <xsl:value-of select="$shortTitle"/>
  198.                     </xsl:when>
  199.                     <xsl:when test="string-length($periodicalTitle)>0">
  200.                       <xsl:value-of select="$periodicalTitle"/>
  201.                     </xsl:when>
  202.                   </xsl:choose>
  203.                 </xsl:when>
  204.  
  205.                 <xsl:when test="b:SourceType='InternetSite' or
  206.                                 b:SourceType='DocumentFromInternetSite'">
  207.                   <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  208.                   <xsl:variable name="internetSiteTitle" select="b:InternetSiteTitle"/>
  209.  
  210.                   <xsl:choose>
  211.                     <xsl:when test="string-length($shortTitle)>0">
  212.                       <xsl:value-of select="$shortTitle"/>
  213.                     </xsl:when>
  214.                     <xsl:when test="string-length($internetSiteTitle)>0">
  215.                       <xsl:value-of select="$internetSiteTitle"/>
  216.                     </xsl:when>
  217.                   </xsl:choose>
  218.                 </xsl:when>
  219.  
  220.                 <xsl:when test="b:SourceType='ElectronicSource' or
  221.                                 b:SourceType='Art' or
  222.                                 b:SourceType='Misc'">
  223.                   <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  224.                   <xsl:variable name="publicationTitle" select="b:PublicationTitle"/>
  225.  
  226.                   <xsl:choose>
  227.                     <xsl:when test="string-length($shortTitle)>0">
  228.                       <xsl:value-of select="$shortTitle"/>
  229.                     </xsl:when>
  230.                     <xsl:when test="string-length($publicationTitle)>0">
  231.                       <xsl:value-of select="$publicationTitle"/>
  232.                     </xsl:when>
  233.                   </xsl:choose>
  234.                 </xsl:when>
  235.  
  236.                 <xsl:when test="b:SourceType='SoundRecording'">
  237.                   <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  238.                   <xsl:variable name="albumTitle" select="b:AlbumTitle"/>
  239.  
  240.                   <xsl:choose>
  241.                     <xsl:when test="string-length($shortTitle)>0">
  242.                       <xsl:value-of select="$shortTitle"/>
  243.                     </xsl:when>
  244.                     <xsl:when test="string-length($albumTitle)>0">
  245.                       <xsl:value-of select="$albumTitle"/>
  246.                     </xsl:when>
  247.                   </xsl:choose>
  248.                 </xsl:when>
  249.  
  250.                 <xsl:when test="b:SourceType='Interview'">
  251.                   <xsl:variable name="shortTitle" select="b:ShortTitle"/>
  252.                   
  253.                   <xsl:variable name="broadcastTitle" select="b:BroadcastTitle"/>
  254.                   
  255.  
  256.                   <xsl:choose>
  257.                     <xsl:when test="string-length($shortTitle)>0">
  258.                       <xsl:value-of select="$shortTitle"/>
  259.                     </xsl:when>
  260.                     
  261.                     <xsl:when test="string-length($broadcastTitle)>0">
  262.                       <xsl:value-of select="$broadcastTitle"/>
  263.                     </xsl:when>
  264.                     
  265.                   </xsl:choose>
  266.                 </xsl:when>
  267.  
  268.               </xsl:choose>
  269.             </xsl:if>
  270.           </b:Title>
  271.           
  272.                     <b:Author>
  273.                         
  274.                         <b:Main>
  275.                             <xsl:if test="string-length(./b:Author/*[local-name()=$MostImportantAuthorLocalName]/b:Corporate)=0">
  276.                                 <b:NameList>
  277.                                     <xsl:for-each select="./b:Author/*[local-name()=$MostImportantAuthorLocalName]/b:NameList/b:Person">
  278.                                         <b:Person>
  279.                                             
  280.                                             <b:Last>
  281.                                                 <xsl:value-of select="./b:Last"/>
  282.                                             </b:Last>
  283.                                             <b:First>
  284.                                                 <xsl:value-of select="./b:First"/>
  285.                                             </b:First>
  286.                                             <b:Middle>
  287.                                                 <xsl:value-of select="./b:Middle"/>
  288.                                             </b:Middle>
  289.                                         </b:Person>
  290.                                     </xsl:for-each>
  291.                                 </b:NameList>
  292.                             </xsl:if>
  293.                             <xsl:if test="string-length(./b:Author/*[local-name()=$MostImportantAuthorLocalName]/b:Corporate)>0">
  294.                                 <b:Corporate>
  295.                                   <xsl:value-of select="./b:Author/*[local-name()=$MostImportantAuthorLocalName]/b:Corporate"/>
  296.                                 </b:Corporate>
  297.                             </xsl:if>
  298.                         </b:Main>
  299.                         <xsl:for-each select="./b:Author/*">
  300.                             
  301.                             <xsl:if test="name()!='b:Main'">
  302.                                 <xsl:element name="{name()}" namespace="{namespace-uri()}">
  303.                                     <xsl:call-template name="copyNameNodes"/>
  304.                                     
  305.                                 </xsl:element>
  306.                             </xsl:if>
  307.                         </xsl:for-each>
  308.                     </b:Author>
  309.                     <xsl:for-each select="*">
  310.                         
  311.             <xsl:if test="name()!='b:Author' and name()!='b:Title'">
  312.               <xsl:element name="{name()}" namespace="{namespace-uri()}">
  313.                                 <xsl:call-template name="copyNodes"/>
  314.                                 
  315.                             </xsl:element>
  316.                         </xsl:if>
  317.                     </xsl:for-each>
  318.                 </xsl:element>
  319.             </xsl:for-each>
  320.             <xsl:for-each select="/*[$Type]/*">
  321.                 
  322.                 <xsl:if test="local-name()!='Source'">
  323.                     <xsl:call-template name="copyTrees"/>
  324.                 </xsl:if>
  325.             </xsl:for-each>
  326.         </xsl:element>
  327.     </xsl:template>
  328.     
  329.     
  330.     
  331.     <xsl:template name="MainContributors">
  332.         <xsl:param name="SourceRoot"/>
  333.         <xsl:choose>
  334.             <xsl:when test="./b:SourceType='Book'">
  335.                 <xsl:choose>
  336.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  337.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  338.                     <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  339.                 </xsl:choose>
  340.             </xsl:when>
  341.  
  342.             <xsl:when test="./b:SourceType='BookSection'">
  343.                 <xsl:choose>
  344.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  345.                     <xsl:when test="string-length(./b:Author/b:BookAuthor)>0">BookAuthor</xsl:when>
  346.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  347.                     <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  348.                 </xsl:choose>
  349.             </xsl:when>
  350.  
  351.             <xsl:when test="./b:SourceType='JournalArticle'">
  352.                 <xsl:choose>
  353.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  354.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  355.                 </xsl:choose>
  356.             </xsl:when>
  357.  
  358.             <xsl:when test="./b:SourceType='ArticleInAPeriodical'">
  359.                 <xsl:choose>
  360.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  361.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  362.                 </xsl:choose>
  363.             </xsl:when>
  364.  
  365.             <xsl:when test="./b:SourceType='ConferenceProceedings'">
  366.                 <xsl:choose>
  367.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  368.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  369.                 </xsl:choose>
  370.             </xsl:when>
  371.  
  372.             <xsl:when test="./b:SourceType='Report'">
  373.                 <xsl:choose>
  374.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  375.                 </xsl:choose>
  376.             </xsl:when>
  377.  
  378.             <xsl:when test="./b:SourceType='SoundRecording'">
  379.                 <xsl:choose>
  380.                     <xsl:when test="string-length(./b:Author/b:Performer)>0">Performer</xsl:when>
  381.                     <xsl:when test="string-length(./b:Author/b:Artist)>0">Artist</xsl:when>
  382.                     <xsl:when test="string-length(./b:Author/b:Composer)>0">Composer</xsl:when>
  383.                     <xsl:when test="string-length(./b:Author/b:Conductor)>0">Conductor</xsl:when>
  384.                     <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  385.                 </xsl:choose>
  386.             </xsl:when>
  387.  
  388.             <xsl:when test="./b:SourceType='Performance'">
  389.                 <xsl:choose>
  390.                     <xsl:when test="string-length(./b:Author/b:Writer)>0">Writer</xsl:when>
  391.                     <xsl:when test="string-length(./b:Author/b:Performer)>0">Performer</xsl:when>
  392.                     <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  393.                     <xsl:when test="string-length(./b:Author/b:Director)>0">Director</xsl:when>
  394.                 </xsl:choose>
  395.             </xsl:when>
  396.  
  397.             <xsl:when test="./b:SourceType='Art'">
  398.                 <xsl:choose>
  399.                     <xsl:when test="string-length(./b:Author/b:Artist)>0">Artist</xsl:when>
  400.                 </xsl:choose>
  401.             </xsl:when>
  402.  
  403.             <xsl:when test="./b:SourceType='DocumentFromInternetSite'">
  404.                 <xsl:choose>
  405.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  406.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  407.                     <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  408.                 </xsl:choose>
  409.             </xsl:when>
  410.  
  411.             <xsl:when test="./b:SourceType='InternetSite'">
  412.                 <xsl:choose>
  413.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  414.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  415.                     <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  416.                 </xsl:choose>
  417.             </xsl:when>
  418.  
  419.             <xsl:when test="./b:SourceType='Film'">
  420.                 <xsl:choose>
  421.                     <xsl:when test="string-length(./b:Author/b:Writer)>0">Writer</xsl:when>
  422.                     <xsl:when test="string-length(./b:Author/b:Performer)>0">Performer</xsl:when>
  423.                     <xsl:when test="string-length(./b:Author/b:Director)>0">Director</xsl:when>
  424.                     <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  425.                 </xsl:choose>
  426.             </xsl:when>
  427.  
  428.             <xsl:when test="./b:SourceType='Interview'">
  429.                 <xsl:choose>
  430.                     <xsl:when test="string-length(./b:Author/b:Interviewee)>0">Interviewee</xsl:when>
  431.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  432.                     <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  433.                     <xsl:when test="string-length(./b:Author/b:Interviewer)>0">Interviewer</xsl:when>
  434.                     <xsl:when test="string-length(./b:Author/b:Compiler)>0">Compiler</xsl:when>
  435.                 </xsl:choose>
  436.             </xsl:when>
  437.  
  438.             <xsl:when test="./b:SourceType='Patent'">
  439.                 <xsl:choose>
  440.                     <xsl:when test="string-length(./b:Author/b:Inventor)>0">Inventor</xsl:when>
  441.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  442.                     <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  443.                 </xsl:choose>
  444.             </xsl:when>
  445.  
  446.             <xsl:when test="./b:SourceType='ElectronicSource'">
  447.                 <xsl:choose>
  448.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  449.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  450.                     <xsl:when test="string-length(./b:Author/b:ProducerName)>0">ProducerName</xsl:when>
  451.                     <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  452.                 </xsl:choose>
  453.             </xsl:when>
  454.  
  455.             <xsl:when test="./b:SourceType='Case'">
  456.                 <xsl:choose>
  457.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  458.                     <xsl:when test="string-length(./b:Author/b:Counsel)>0">Counsel</xsl:when>
  459.                 </xsl:choose>
  460.             </xsl:when>
  461.  
  462.             <xsl:when test="./b:SourceType='Misc'">
  463.                 <xsl:choose>
  464.                     <xsl:when test="string-length(./b:Author/b:Author)>0">Author</xsl:when>
  465.                     <xsl:when test="string-length(./b:Author/b:Editor)>0">Editor</xsl:when>
  466.                     <xsl:when test="string-length(./b:Author/b:Translator)>0">Translator</xsl:when>
  467.                     <xsl:when test="string-length(./b:Author/b:Compiler)>0">Compiler</xsl:when>
  468.                 </xsl:choose>
  469.             </xsl:when>
  470.         </xsl:choose>
  471.     </xsl:template>
  472.  
  473.     <xsl:template name="copyNameNodes">
  474.         <xsl:if test="string-length(b:Corporate)=0">
  475.             <b:NameList>
  476.                 <xsl:for-each select="b:NameList/b:Person">
  477.                     
  478.                     <b:Person>
  479.                         
  480.                         <xsl:if test="string-length(./b:Last)>0">
  481.                             
  482.                             <b:Last>
  483.                                 <xsl:value-of select="./b:Last"/>
  484.                             </b:Last>
  485.                         </xsl:if>
  486.                         <xsl:if test="string-length(./b:First)>0">
  487.                             <b:First>
  488.                                 <xsl:value-of select="./b:First"/>
  489.                             </b:First>
  490.                         </xsl:if>
  491.                         <xsl:if test="string-length(./b:Middle)">
  492.                             <b:Middle>
  493.                                 <xsl:value-of select="./b:Middle"/>
  494.                             </b:Middle>
  495.                         </xsl:if>
  496.                     </b:Person>
  497.                 </xsl:for-each>
  498.             </b:NameList>
  499.         </xsl:if>
  500.         <xsl:if test="string-length(b:Corporate)>0">
  501.             <b:Corporate>
  502.               <xsl:value-of select="b:Corporate"/>
  503.             </b:Corporate>
  504.         </xsl:if>
  505.     </xsl:template>
  506.  
  507.  
  508.     <xsl:template name="copyNodes">
  509.         <xsl:value-of select="."/>
  510.     </xsl:template>
  511.  
  512.  
  513.     <xsl:template name="copyTrees">
  514.         <xsl:copy-of select ='.'/>
  515.     </xsl:template>
  516.  
  517.     <xsl:template name="simplesearchField">
  518.         <xsl:choose>
  519.             <xsl:when test="local-name()='Guid'"/>
  520.             <xsl:when test="local-name()='RefOrder'"/>
  521.             <xsl:when test="local-name()='SourceType'"/>
  522.             <xsl:otherwise>
  523.                 <xsl:value-of select="." /><xsl:text> </xsl:text>
  524.             </xsl:otherwise>
  525.         </xsl:choose>
  526.  
  527.         <xsl:for-each select="*">
  528.                 <xsl:call-template name="simplesearchField"/>
  529.         </xsl:for-each>
  530.     </xsl:template>
  531.  
  532.     <xsl:template name="simplesearchSource">
  533.         <xsl:for-each select="*">
  534.             <xsl:call-template name="simplesearchField"/>
  535.         </xsl:for-each>
  536.     </xsl:template>
  537.  
  538.   <xsl:template name="formatIntervieweeLfmSku">
  539.     <xsl:for-each select="b:Author/b:Interviewee">
  540.       <xsl:call-template name="formatPersonsAuthor"/>
  541.     </xsl:for-each>
  542.   </xsl:template>
  543.  
  544.   <xsl:template name="formatInterviewerLfmSku">
  545.     <xsl:for-each select="b:Author/b:Interviewer">
  546.       <xsl:call-template name="formatPersonsAuthor"/>
  547.     </xsl:for-each>
  548.   </xsl:template>
  549.  
  550.   <xsl:template name="formatPersonsAuthor">
  551.     <xsl:if test="string-length(b:Corporate)=0">
  552.         <xsl:for-each select="b:NameList/b:Person">
  553.           <xsl:if test="6 >= position()">
  554.             <xsl:call-template name="formatMainAuthor"/>
  555.           </xsl:if>
  556.           <xsl:call-template name="formatPersonSeperatorMain"/>
  557.         </xsl:for-each>
  558.     </xsl:if>
  559.     <xsl:if test="string-length(b:Corporate)>0">
  560.       <xsl:value-of select="b:Corporate"/>
  561.     </xsl:if>
  562.   </xsl:template>
  563.  
  564.   <xsl:template name="formatMainAuthor">
  565.     <xsl:call-template name="formatNameCore">
  566.       <xsl:with-param name="FML">
  567.         <xsl:call-template name="templ_prop_Authors_FML"/>
  568.       </xsl:with-param>
  569.       <xsl:with-param name="FM">
  570.         <xsl:call-template name="templ_prop_Authors_FM"/>
  571.       </xsl:with-param>
  572.       <xsl:with-param name="ML">
  573.         <xsl:call-template name="templ_prop_Authors_ML"/>
  574.       </xsl:with-param>
  575.       <xsl:with-param name="FL">
  576.         <xsl:call-template name="templ_prop_Authors_FL"/>
  577.       </xsl:with-param>
  578.       <xsl:with-param name="upperLast">no</xsl:with-param>
  579.       <xsl:with-param name="withDot">yes</xsl:with-param>
  580.  
  581.     </xsl:call-template>
  582.   </xsl:template>
  583.  
  584.   <xsl:template name="formatPersonSeperatorMain">
  585.     <xsl:param name="isLast"/>
  586.  
  587.     <xsl:choose>
  588.       <xsl:when test="6 >= count(../b:Person) and position() = count(../b:Person) - 1">
  589.         <xsl:call-template name="templ_prop_AuthorsSeparator"/>
  590.         <xsl:if test="string-length($isLast)=0 or $isLast=true()">
  591.           <xsl:call-template name="templ_prop_Space"/>
  592.         </xsl:if>
  593.       </xsl:when>
  594.       <xsl:when test="6 > position() and position() != count(../b:Person)">
  595.         <xsl:call-template name="templ_prop_AuthorsSeparator"/>
  596.       </xsl:when>
  597.       <xsl:when test="count(../b:Person) > 6 and position() = count(../b:Person)">
  598.         <xsl:call-template name="templ_prop_AuthorsSeparator"/>
  599.         <xsl:call-template name="templ_str_AndOthersUnCap"/>
  600.       </xsl:when>
  601.       <xsl:when test="position()>6">
  602.       </xsl:when>
  603.     </xsl:choose>
  604.   </xsl:template>
  605.  
  606.   <xsl:template name="formatNameCore">
  607.     <xsl:param name="FML"/>
  608.     <xsl:param name="FM"/>
  609.     <xsl:param name="ML"/>
  610.     <xsl:param name="FL"/>
  611.     <xsl:param name="upperLast"/>
  612.     <xsl:param name="withDot"/>
  613.  
  614.     <xsl:variable name="first">
  615.       <xsl:call-template name="handleSpaces">
  616.         <xsl:with-param name="field" select="b:First"/>
  617.       </xsl:call-template>
  618.     </xsl:variable>
  619.  
  620.     <xsl:variable name="middle">
  621.       <xsl:call-template name="handleSpaces">
  622.         <xsl:with-param name="field" select="b:Middle"/>
  623.       </xsl:call-template>
  624.     </xsl:variable>
  625.  
  626.     <xsl:variable name="last">
  627.       <xsl:call-template name="handleSpaces">
  628.         <xsl:with-param name="field" select="b:Last"/>
  629.       </xsl:call-template>
  630.     </xsl:variable>
  631.  
  632.     <xsl:variable name="format">
  633.       <xsl:choose>
  634.         <xsl:when test="string-length($first) = 0 and string-length($middle) = 0 and string-length($last) = 0 ">
  635.         </xsl:when>
  636.         <xsl:when test="string-length($first) = 0 and string-length($middle) = 0 and string-length($last) != 0 ">
  637.           <xsl:text>%L</xsl:text>
  638.         </xsl:when>
  639.         <xsl:when test="string-length($first) = 0 and string-length($middle) != 0 and string-length($last) = 0 ">
  640.           <xsl:text>%M</xsl:text>
  641.         </xsl:when>
  642.         <xsl:when test="string-length($first) = 0 and string-length($middle) != 0 and string-length($last) != 0 ">
  643.           <xsl:value-of select="$ML"/>
  644.         </xsl:when>
  645.         <xsl:when test="string-length($first) != 0 and string-length($middle) = 0 and string-length($last) = 0 ">
  646.           <xsl:text>%F</xsl:text>
  647.         </xsl:when>
  648.         <xsl:when test="string-length($first) != 0 and string-length($middle) = 0 and string-length($last) != 0 ">
  649.           <xsl:value-of select="$FL"/>
  650.         </xsl:when>
  651.         <xsl:when test="string-length($first) != 0 and string-length($middle) != 0 and string-length($last) = 0 ">
  652.           <xsl:value-of select="$FM"/>
  653.         </xsl:when>
  654.         <xsl:when test="string-length($first) != 0 and string-length($middle) != 0 and string-length($last) != 0 ">
  655.           <xsl:value-of select="$FML"/>
  656.         </xsl:when>
  657.       </xsl:choose>
  658.     </xsl:variable>
  659.  
  660.     <xsl:call-template name="StringFormatName">
  661.       <xsl:with-param name="format" select="$format"/>
  662.       <xsl:with-param name="upperLast" select="$upperLast"/>
  663.       <xsl:with-param name="withDot" select="$withDot"/>
  664.     </xsl:call-template>
  665.  
  666.   </xsl:template>
  667.  
  668.   <xsl:template name="StringFormatName">
  669.     <xsl:param name="format" />
  670.     <xsl:param name="withDot" />
  671.     <xsl:param name="upperLast"/>
  672.  
  673.     <xsl:variable name="prop_EndChars">
  674.       <xsl:call-template name="templ_prop_EndChars"/>
  675.     </xsl:variable>
  676.  
  677.     <xsl:choose>
  678.       <xsl:when test="$format = ''"></xsl:when>
  679.       <xsl:when test="substring($format, 1, 2) = '%%'">
  680.         <xsl:text>%</xsl:text>
  681.         <xsl:call-template name="StringFormatName">
  682.           <xsl:with-param name="format" select="substring($format, 3)" />
  683.           <xsl:with-param name="withDot" select="$withDot" />
  684.           <xsl:with-param name="upperLast" select="$upperLast" />
  685.         </xsl:call-template>
  686.  
  687.         <xsl:if test="string-length($format)=2 and withDot = 'yes' and not(contains($prop_EndChars, '%'))">
  688.           <xsl:call-template name="templ_prop_Dot"/>
  689.         </xsl:if>
  690.       </xsl:when>
  691.       <xsl:when test="substring($format, 1, 1) = '%'">
  692.         <xsl:variable name="what" select="substring($format, 2, 1)" />
  693.  
  694.         <xsl:choose>
  695.           <xsl:when test="(what = 'l' or what = 'L') and upperLast = 'yes'">
  696.             <span style='text-transform: uppercase;'>
  697.               <xsl:call-template name="formatNameOneItem">
  698.                 <xsl:with-param name="format" select="$what"/>
  699.               </xsl:call-template>
  700.             </span>
  701.           </xsl:when>
  702.           <xsl:otherwise>
  703.             <xsl:call-template name="formatNameOneItem">
  704.               <xsl:with-param name="format" select="$what"/>
  705.             </xsl:call-template>
  706.           </xsl:otherwise>
  707.         </xsl:choose>
  708.         <xsl:call-template name="StringFormatName">
  709.           <xsl:with-param name="format" select="substring($format, 3)" />
  710.           <xsl:with-param name="withDot" select="$withDot" />
  711.           <xsl:with-param name="upperLast" select="$upperLast" />
  712.         </xsl:call-template>
  713.         <xsl:if test="string-length($format)=2 and withDot='yes'">
  714.           <xsl:variable name="temp2">
  715.             <xsl:call-template name="handleSpaces">
  716.               <xsl:with-param name="field">
  717.                 <xsl:call-template name="formatNameOneItem">
  718.                   <xsl:with-param name="format" select="$what"/>
  719.                 </xsl:call-template>
  720.               </xsl:with-param>
  721.             </xsl:call-template>
  722.           </xsl:variable>
  723.           <xsl:variable name="lastChar">
  724.             <xsl:value-of select="substring($temp2, string-length($temp2))"/>
  725.           </xsl:variable>
  726.           <xsl:if test="not(contains($prop_EndChars, $lastChar))">
  727.             <xsl:call-template name="templ_prop_Dot"/>
  728.           </xsl:if>
  729.         </xsl:if>
  730.       </xsl:when>
  731.       <xsl:otherwise>
  732.         <xsl:value-of select="substring($format, 1, 1)" />
  733.         <xsl:call-template name="StringFormatName">
  734.           <xsl:with-param name="format" select="substring($format, 2)" />
  735.           <xsl:with-param name="withDot" select="$withDot" />
  736.           <xsl:with-param name="upperLast" select="$upperLast" />
  737.         </xsl:call-template>
  738.         <xsl:if test="string-length($format)=1">
  739.           <xsl:if test="withDot = 'yes' and not(contains($prop_EndChars, $format))">
  740.             <xsl:call-template name="templ_prop_Dot"/>
  741.           </xsl:if>
  742.         </xsl:if>
  743.       </xsl:otherwise>
  744.     </xsl:choose>
  745.   </xsl:template>
  746.  
  747.   <xsl:template name="formatNameOneItem">
  748.     <xsl:param name="format"/>
  749.  
  750.     <xsl:choose>
  751.       <xsl:when test="$format = 'F'">
  752.         <xsl:value-of select="b:First"/>
  753.       </xsl:when>
  754.       <xsl:when test="$format = 'L'">
  755.         <xsl:value-of select="b:Last"/>
  756.       </xsl:when>
  757.       <xsl:when test="$format = 'M'">
  758.         <xsl:value-of select="b:Middle"/>
  759.       </xsl:when>
  760.       <xsl:when test="$format = 'f'">
  761.         <xsl:call-template name="formatNameInitial">
  762.           <xsl:with-param name="name" select="b:First"/>
  763.         </xsl:call-template>
  764.       </xsl:when>
  765.       <xsl:when test="$format = 'm'">
  766.         <xsl:call-template name="formatNameInitial">
  767.           <xsl:with-param name="name" select="b:Middle"/>
  768.         </xsl:call-template>
  769.       </xsl:when>
  770.       <xsl:when test="$format = 'l'">
  771.         <xsl:call-template name="formatNameInitial">
  772.           <xsl:with-param name="name" select="b:Last"/>
  773.         </xsl:call-template>
  774.       </xsl:when>
  775.     </xsl:choose>
  776.  
  777.   </xsl:template>
  778.  
  779.   <xsl:template name="formatNameInitial">
  780.     <xsl:param name="name"/>
  781.     <xsl:variable name="temp">
  782.       <xsl:call-template name="handleSpaces">
  783.         <xsl:with-param name="field" select="$name"/>
  784.       </xsl:call-template>
  785.     </xsl:variable>
  786.  
  787.     <xsl:variable name="prop_APA_Hyphens">
  788.       <xsl:call-template name="templ_prop_Hyphens"/>
  789.     </xsl:variable>
  790.  
  791.     <xsl:if test="string-length($temp)>0">
  792.  
  793.       <xsl:variable name="tempWithoutSpaces">
  794.         <xsl:value-of select="translate($temp, '  ', '')"/>
  795.         
  796.       </xsl:variable>
  797.  
  798.       <xsl:if test="not(contains($prop_APA_Hyphens, substring($tempWithoutSpaces, 1, 1)))">
  799.         <xsl:value-of select="substring($tempWithoutSpaces, 1, 1)"/>
  800.         <xsl:call-template name="templ_prop_DotInitial"/>
  801.       </xsl:if>
  802.  
  803.       <xsl:call-template name="handleHyphens">
  804.         <xsl:with-param name="name" select="$tempWithoutSpaces"/>
  805.       </xsl:call-template>
  806.     </xsl:if>
  807.   </xsl:template>
  808.  
  809.   <xsl:template name="handleHyphens">
  810.     <xsl:param name="name"/>
  811.  
  812.     <xsl:variable name="prop_APA_Hyphens">
  813.       <xsl:call-template name="templ_prop_Hyphens"/>
  814.     </xsl:variable>
  815.  
  816.     <xsl:if test="string-length($name)>=2">
  817.       <xsl:choose>
  818.         <xsl:when test="contains($prop_APA_Hyphens, substring($name, 1, 1))">
  819.           <xsl:value-of select="substring($name, 1, 2)"/>
  820.           <xsl:call-template name="templ_prop_DotInitial"/>
  821.  
  822.           <xsl:call-template name="handleHyphens">
  823.             <xsl:with-param name="name" select="substring($name, 3)"/>
  824.           </xsl:call-template>
  825.         </xsl:when>
  826.  
  827.         <xsl:otherwise>
  828.           <xsl:call-template name="handleHyphens">
  829.             <xsl:with-param name="name" select="substring($name, 2)"/>
  830.           </xsl:call-template>
  831.         </xsl:otherwise>
  832.       </xsl:choose>
  833.  
  834.     </xsl:if>
  835.  
  836.   </xsl:template>
  837.  
  838.   <xsl:template name="handleSpaces">
  839.     <xsl:param name="field"/>
  840.  
  841.     <xsl:variable name="prop_NormalizeSpace">
  842.       <xsl:call-template name="templ_prop_NormalizeSpace"/>
  843.     </xsl:variable>
  844.  
  845.     <xsl:choose>
  846.       <xsl:when test="$prop_NormalizeSpace='yes'">
  847.         <xsl:value-of select="normalize-space($field)"/>
  848.       </xsl:when>
  849.       <xsl:otherwise>
  850.         <xsl:value-of select="$field"/>
  851.       </xsl:otherwise>
  852.     </xsl:choose>
  853.   </xsl:template>
  854.  
  855.   <xsl:template name="localLCID">
  856.     <xsl:value-of select="/*/b:Locals/b:DefaultLCID"/>
  857.   </xsl:template>
  858.  
  859.   
  860.   <xsl:template name="templ_prop_NormalizeSpace" >
  861.     <xsl:param name="LCID" />
  862.     <xsl:variable name="_LCID">
  863.       <xsl:call-template name="localLCID">
  864.         <xsl:with-param name="LCID" select="$LCID"/>
  865.       </xsl:call-template>
  866.     </xsl:variable>
  867.     <xsl:text>no</xsl:text>
  868.     
  869.   </xsl:template>
  870.  
  871.   
  872.   <xsl:template name="templ_prop_AuthorsSeparator" >
  873.     <xsl:param name="LCID" />
  874.     <xsl:variable name="_LCID">
  875.       <xsl:call-template name="localLCID">
  876.         <xsl:with-param name="LCID" select="$LCID"/>
  877.       </xsl:call-template>
  878.     </xsl:variable>
  879.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:AuthorsSeparator"/>
  880.   </xsl:template>
  881.  
  882.   
  883.   <xsl:template name="templ_prop_Space" >
  884.     <xsl:param name="LCID" />
  885.     <xsl:variable name="_LCID">
  886.       <xsl:call-template name="localLCID">
  887.         <xsl:with-param name="LCID" select="$LCID"/>
  888.       </xsl:call-template>
  889.     </xsl:variable>
  890.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:Space"/>
  891.   </xsl:template>
  892.  
  893.   
  894.   <xsl:template name="templ_str_AndOthersUnCap" >
  895.     <xsl:param name="LCID" />
  896.     <xsl:variable name="_LCID">
  897.       <xsl:call-template name="localLCID">
  898.         <xsl:with-param name="LCID" select="$LCID"/>
  899.       </xsl:call-template>
  900.     </xsl:variable>
  901.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Strings/b:AndOthersUnCap"/>
  902.   </xsl:template>
  903.  
  904.   
  905.   <xsl:template name="templ_prop_EndChars" >
  906.     <xsl:param name="LCID" />
  907.     <xsl:variable name="_LCID">
  908.       <xsl:call-template name="localLCID">
  909.         <xsl:with-param name="LCID" select="$LCID"/>
  910.       </xsl:call-template>
  911.     </xsl:variable>
  912.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:EndChars"/>
  913.   </xsl:template>
  914.  
  915.   
  916.   <xsl:template name="templ_prop_Dot" >
  917.     <xsl:param name="LCID" />
  918.     <xsl:variable name="_LCID">
  919.       <xsl:call-template name="localLCID">
  920.         <xsl:with-param name="LCID" select="$LCID"/>
  921.       </xsl:call-template>
  922.     </xsl:variable>
  923.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:Dot"/>
  924.   </xsl:template>
  925.  
  926.   
  927.   <xsl:template name="templ_prop_Authors_FML" >
  928.     <xsl:param name="LCID" />
  929.     <xsl:variable name="_LCID">
  930.       <xsl:call-template name="localLCID">
  931.         <xsl:with-param name="LCID" select="$LCID"/>
  932.       </xsl:call-template>
  933.     </xsl:variable>
  934.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Authors/b:FML"/>
  935.   </xsl:template>
  936.  
  937.   
  938.   <xsl:template name="templ_prop_Authors_FM" >
  939.     <xsl:param name="LCID" />
  940.     <xsl:variable name="_LCID">
  941.       <xsl:call-template name="localLCID">
  942.         <xsl:with-param name="LCID" select="$LCID"/>
  943.       </xsl:call-template>
  944.     </xsl:variable>
  945.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Authors/b:FM"/>
  946.   </xsl:template>
  947.  
  948.   
  949.   <xsl:template name="templ_prop_Authors_ML" >
  950.     <xsl:param name="LCID" />
  951.     <xsl:variable name="_LCID">
  952.       <xsl:call-template name="localLCID">
  953.         <xsl:with-param name="LCID" select="$LCID"/>
  954.       </xsl:call-template>
  955.     </xsl:variable>
  956.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Authors/b:ML"/>
  957.   </xsl:template>
  958.  
  959.   
  960.   <xsl:template name="templ_prop_Authors_FL" >
  961.     <xsl:param name="LCID" />
  962.     <xsl:variable name="_LCID">
  963.       <xsl:call-template name="localLCID">
  964.         <xsl:with-param name="LCID" select="$LCID"/>
  965.       </xsl:call-template>
  966.     </xsl:variable>
  967.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:Authors/b:FL"/>
  968.   </xsl:template>
  969.  
  970.   
  971.   <xsl:template name="templ_prop_Hyphens" >
  972.     <xsl:param name="LCID" />
  973.     <xsl:variable name="_LCID">
  974.       <xsl:call-template name="localLCID">
  975.         <xsl:with-param name="LCID" select="$LCID"/>
  976.       </xsl:call-template>
  977.     </xsl:variable>
  978.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:Hyphens"/>
  979.   </xsl:template>
  980.  
  981.   
  982.   <xsl:template name="templ_prop_DotInitial" >
  983.     <xsl:param name="LCID" />
  984.     <xsl:variable name="_LCID">
  985.       <xsl:call-template name="localLCID">
  986.         <xsl:with-param name="LCID" select="$LCID"/>
  987.       </xsl:call-template>
  988.     </xsl:variable>
  989.     <xsl:value-of select="/*/b:Locals/b:Local[@LCID=$_LCID]/b:General/b:DotInitial"/>
  990.   </xsl:template>
  991.  
  992.  
  993. </xsl:stylesheet>
  994.  
  995.